import axios from "axios"

const state = {
    carouselList: []
}

const mutations = {
    CAROUSELLIST(state, payload) {
        setTimeout(() => {
            state.carouselList = payload
        }, 300)
    }
}

const actions = {
    // 获取漫画轮播
    getCarouselList({commit}) {
        axios({
            url: "/api/carousel",
            headers: {
                'channelid': '395842662903689216',
                "sourceid": 2,
                "X-Tingyun-Id": "d1VZoc7h8h4;r=253934676"
            },
        }).then(res => {
            if(res.data.code === 200) {
                commit("CAROUSELLIST", res.data.data)
            }
        })
    }
}

const getters = {}

export default {
    namespaced: true,
    state,
    mutations,
    actions,
    getters,
}
